/** 
 *  @file
 *  @brief   MASS1 单元 和 MASS2 单元
 *  @author  LiuXing
 *  @date    2025.07.22
 *  @version v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */


#pragma once
#include "Utility/Algebra/Matrix.h"
#include "DataStructure/Common/Out.h"
#include "DataStructure/Common/Real.h"
#include "../Interface/IElementCalculator.h"


SG_FEMSOLVER_ELEMENT_NAMESPACE_OPEN

class ElementCalculator_DECLSPEC MASSiCalculator : public SG::FEMSolver::Element::IElementCalculator
{
public:
    MASSiCalculator () = default;
    virtual ~MASSiCalculator () = default;

    /**
     * @brief 计算位移坐标系下单元质量矩阵
     * 
     * @param [in] m 标量质量值
     * @param [out] km 位移坐标系下单元质量矩阵
     */
    static void ComputeMass (const SG::DataStructure::Common::Real m, _OUT SG::Algebra::Matrixd& mm);
    
    virtual void Initialize (SG::DataStructure::FEM::ElementTypes type) override;
    virtual void ComputeElementMatries (const SG::DBManager::DBServiceFactorySP dbServiceFactory) override;
    virtual void DataRecovery (const SG::DBManager::DBServiceFactorySP dbServiceFactory, int subcaseId, SG::DataStructure::Common::Real time, const std::vector<SG::DataStructure::Common::Real>& globalDisplacement) override {}
    virtual void ComputeStressStiffness (const SG::DBManager::DBServiceFactorySP dbServiceFactory, int staticSubId) override {}

    static ElementCalculatorSP Create () {return std::make_shared<MASSiCalculator> ();}

private:
    SG::DataStructure::FEM::ElementTypes m_type;
};


SG_FEMSOLVER_ELEMENT_NAMESPACE_CLOSE